<html   xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
        layout:decorator="layout"
        data-search-facets>
<head>
    <title th:inline="text">Search</title>
    <link rel="alternate" type="application/atom+xml" th:href="${feedPath}" />
    <link rel="stylesheet" type="text/css" th:href="@{/css/search.css}"/>
</head>
<body>
<div layout:fragment="header-container"></div>
<div layout:fragment="content" class="container">
  <div class="main-body--wrapper search-results-page">
    <div class="row-fluid">
        <div id="content" class="span8">
      <div class="search-results--count" th:inline="text">[[${totalResultsCount}]] results</div>

            <div th:if="${results.empty}" class="warning alert-warning">
                No results found for your query.
            </div>
            <div th:if="${!results.empty}" class='search-results'>
                <section class="search-result" th:each="result : ${results}">
                    <a th:href="@{${result.path}}" th:text="${result.title}" class="search-result--title">This week in Spring</a>
                    <div class="metadata">
                        <div class="search-result--subtitle" th:text="${result.subTitle}" th:if="${result.subTitle}">Blog Post</div>
                    </div>
                    <div th:utext="${result.displayText}" class='search-result--summary'>This has been an interesting week.</div>
                </section>
            </div>
            <div id='pagination_control' class="pagination" th:if="${paginationInfo.isVisible()}">
                <a th:href="@{/search(page=${paginationInfo.previousPageNumber},q=${searchForm.q},filters=${searchForm.filters})}" class='previous' th:if="${paginationInfo.previousVisible}"><i class="icon-chevron-left"></i></a>

                <div th:each="element : ${paginationInfo.pageElements }" >
                    <a th:href="@{${@uih.path()}(page=${element.label},q=${searchForm.q},filters=${searchForm.filters})}" th:text="${element.label}" th:if="${element.navigable}" ></a>
                    <div th:text="${element.label}" th:if="${!element.navigable && element.currentPage}" class="active" ></div>
                    <div th:text="${element.label}" th:unless="${element.navigable || element.currentPage}" ></div>
                </div>

                <a th:href="@{/search(page=${paginationInfo.nextPageNumber},q=${searchForm.q},filters=${searchForm.filters})}" class='next' th:if="${paginationInfo.nextVisible}"><i class="icon-chevron-right"></i></a>
            </div>
        </div>

    <aside class="span4">
      <div class="search-facets content-container--wrapper">
        <form th:action="@{/search}" method="GET" th:object="${searchForm}" onsubmit="interceptFilterForm(this);">
          <input type="hidden" name="q" th:value="${searchForm.q}" />
          <header class="content-container--header">
            <h3 class="header-title">Filter Your Results</h3>
            <input type="submit" value="Filter" class="btn btn-black compact pull-right on-black uppercase" ></input>
          </header>
          <ul layout:include="search/_facets :: facets" th:with="root=${rootFacet}">
          </ul>
        </form>
      </div>
      <a href="#" class="facets--clear-filters pull-right">Clear Filters</a>
     </aside>

  </div>
</div>
</div>
</body>
</html>
